library(tidyverse)
library(here)
library(treemapify)
library(RColorBrewer)
library(haven)
library(readxl)
library(sf)
library(extrafont)
library(ggrepel)
library(waffle)
library(leaflet)
library(htmltools)


# Load data
findex <- read_csv("../fininc-data/clean/clean.findex.csv")
imf <- read_csv("../fininc-data/clean/clean.imf.csv")
finac.k.15 <- read_csv("../fininc-data/clean/clean.finac.k.15.csv")
finac.k.13 <- read_csv("../fininc-data/clean/clean.finac.k.13.csv")
finac.k.06 <- read_csv("../fininc-data/clean/clean.finac.k.06.csv")
wdi <- read_csv("../fininc-data/clean/clean.wdi.csv")
pop <- read_csv("../fininc-data/clean/clean.pop.csv")


# Get geospatial data
kenya <- read_sf(dsn="../fininc-data/ken_admbnda_adm1_iebc_20180607", layer = "ken_admbnda_adm1_iebc_20180607")
  
  # Cut excess variables
  kenya <- kenya %>%
    select(Shape_Leng, Shape_Area, ADM1_EN, geometry) %>%
    rename(county = "ADM1_EN")


# Define theme
  my.theme <-
    theme(text = element_text(family = "Avenir Next"),
          plot.title = element_text(face = "bold"),
          plot.subtitle = element_text(face = "italic"),
          panel.grid.minor = element_blank(),
          panel.grid = element_line(linetype = "solid", size = 0.3),
          panel.border = element_rect(color = "gray", fill = NA, size = 0.1),
          panel.background = element_rect(color = "black", fill = "#f2f2f2")
          )

This project aims to explore data on financial inclusion and mobile money, primarily in developing countries.

Financial inclusion means that households and businesses can access financial products and services for day-to-day spending, long-term planning, or emergencies. At the most basic level, financial inclusion enables access to an account to use for payments and savings. Shifting payments (for work, agricultural goods, remittances, government transfers, etc.) from cash into accounts can improve efficiency and convenience. Similarly, accounts for savings can provide safety from theft, but also curb impulse spending. Additionally, financial inclusion also incorporates access to credit and insurance. Ultimately, reliable access to finance can serve to reduce poverty by enabling individuals to invest in health, education, and their livelihoods. Evidence at the micro-level from various interventions supports this claim, although for microcredit the evidence is mixed.

Analyzing the Cost of Finance

Finance may be considered a constraint to economic growth if the supply is constrained relative to demand. One means of understanding this is by analyzing the cost of finance, as measured by the real interest rate. A high interest rate, indicates a high cost of finance. A high cost of finance could be the result of low savings or costly intermediation. If low savings is the culprit, then we would expect that countries with a high interest rate also have a low savings, which is measured here as the number of depositors with commerical banks per 1,000 adults. A small number of depositors may indicate that banks have a limited amounts of funds to access and loan.

Below, we first observe that there is no clear relationship between GDP and interest rates. Madagascar has a very high interest rate and a small number of depositors. Thus, one might conclude that low savings is causing the high cost of finance. Brazil also has a very high interest rate, but the number of depositors is not quite as small as Madagascar. In contrast, the interest rate in Singapore is not very high, and there are a large number of depositors, indicating that finance is not a constraint to the economy.

  # Create dataframe of labels - MDG, TLS, BRA, QAT, SGP, KWT, BRN, ARG, SUR
  labels.bubble <-   wdi %>%
    filter(year==2016, cntry.code!="SSD") %>%
    select(cntry.code, year, ny.gdp.pcap.kd, fr.inr.rinr) %>%
    left_join(imf) %>%
    select(cntry.code, economy, year, ny.gdp.pcap.kd, fr.inr.rinr, i_depositors_A1_pop, i_deposit_acc_A1_pop, Region) %>%
    filter(!is.na(fr.inr.rinr)) %>%
    filter(cntry.code %in% c("MDG", "TLS", "BRA", "QAT", "SGP", "KWT", "BRN", "ARG", "SUR", "BWA")) %>%
    mutate(label = paste0(economy, ": ", round(i_depositors_A1_pop, 0)))


wdi %>%
    filter(year==2016) %>%
    select(cntry.code, year, ny.gdp.pcap.kd, fr.inr.rinr) %>%
    left_join(imf) %>%
    select(cntry.code, year, ny.gdp.pcap.kd, fr.inr.rinr, i_depositors_A1_pop, i_deposit_acc_A1_pop, Region) %>%
    filter(!is.na(fr.inr.rinr) & !is.na(ny.gdp.pcap.kd) & !is.na(i_depositors_A1_pop)) %>%
  ggplot(aes(x = ny.gdp.pcap.kd, y = fr.inr.rinr, size = i_depositors_A1_pop)) +
    geom_point(color = "#266197") +
    scale_size_continuous(name = "# of Depositors per\n1,000 adults", range = c(0, 8)) +
    scale_x_continuous(labels = scales::comma) +
    geom_label_repel(data = labels.bubble, aes(label = label), family = "Avenir Next", size = 3,
                   show.legend = FALSE, angle = 30, nudge_x = 0.2, box.padding = 0.5) +
    labs(
      title = "Low savings does not necessarily translate to a high cost of finance",
      subtitle = "As measured by the real interest rate, GDP per capita, 2016\n\nValues in labels are # of depositors",
      caption = "Source: World Development Indicators, IMF Financial Access Survey, 2016",
      y = "Real Interest Rate (%)",
      x = "GDP per capita, (constant 2010 US$)"
    ) +
    my.theme +
    theme(legend.position = c(0.75, 0.97),
          legend.justification = c("left", "top"),
          legend.box.just = "left",
          legend.margin = margin(6, 6, 6, 6),
          legend.box.background = element_rect(),
          ) +
    annotate("rect", xmin = 0, xmax = 20000, ymin = 38, ymax = 55, alpha = 0.15) +
    annotate("text", x = 17000, y = 50, label = "High cost of finance", family = "Avenir Next") +
    annotate("rect", xmin = 1000, xmax = 16000, ymin = -18, ymax = -2, alpha = 0.15) +
    annotate("text", x = 18000, y = -15, label = "Low cost of finance", family = "Avenir Next")

In the chart below, we can take a closer look at the variation in economies with GDP per capita less than $20,000. As above, there is no clear relationship between income levels and the interest rate. In countries such as Uganda and the Kyrgyz Republic, the interest rate is high, and the number of depositors is small, indicating that finance is potentially a constraint. In contrast, China has a relatively low interest rate, and an extremely small number of depositors.

  # Countries with GDP < $20,000
  # Create dataframe of labels - MDG, TLS, BRA, QAT, SGP, KWT, BRN, ARG, SUR
  labels.bubble2 <-   wdi %>%
    filter(year==2016, cntry.code!="SSD") %>%
    select(cntry.code, year, ny.gdp.pcap.kd, fr.inr.rinr) %>%
    left_join(imf) %>%
    select(cntry.code, economy, year, ny.gdp.pcap.kd, fr.inr.rinr, i_depositors_A1_pop, i_deposit_acc_A1_pop, Region) %>%
    filter(!is.na(fr.inr.rinr)) %>%
    filter(cntry.code %in% c("MDG", "TLS", "BRA", "ARG", "SUR", "BWA", "CHN", "UGA", "KGZ")) %>%
    mutate(label = paste0(economy, ": ", round(i_depositors_A1_pop, 0)))

 
  
  wdi %>%
    filter(year==2016, ny.gdp.pcap.kd<20000) %>%
    select(cntry.code, year, ny.gdp.pcap.kd, fr.inr.rinr) %>%
    left_join(imf) %>%
    select(cntry.code, year, ny.gdp.pcap.kd, fr.inr.rinr, i_depositors_A1_pop, i_deposit_acc_A1_pop, Region) %>%
    filter(!is.na(fr.inr.rinr) & !is.na(ny.gdp.pcap.kd) & !is.na(i_depositors_A1_pop)) %>%
  ggplot(aes(x = ny.gdp.pcap.kd, y = fr.inr.rinr, size = i_depositors_A1_pop)) +
    geom_point(color = "#266197") +
    scale_size_continuous(name = "# of Depositors per \n1,000 adults", range = c(0, 8)) +
    scale_x_continuous(labels = scales::comma) +
    geom_label_repel(data = labels.bubble2, aes(label = label), family = "Avenir Next", size = 3,
                   show.legend = FALSE, angle = 30, nudge_x = 0.2, box.padding = 0.5) +
    labs(
      title = "A Closer Look at economies with GDP per capita less than $20,000",
      subtitle = "As measured by the real interest rate, GDP per capita\n\nValues in labels are # of depositors",
      caption = "Source: World Development Indicators, IMF Financial Access Survey, 2016",
      y = "Real Interest Rate (%)",
      x = "GDP per capita, (constant 2010 US$)"
    ) +
    my.theme +
    theme(legend.position = c(0.785, 0.97),
          legend.justification = c("left", "top"),
          legend.box.just = "left",
          legend.margin = margin(6, 6, 6, 6),
          legend.box.background = element_rect(),
          )

Financial Inclusion and Mobile Money

Technology has been instrumental in improving access to finance, namely mobile money and digital payments. East Africa have been at the forefront of mobile money. Mobile money allows for easy and safe transfers of resources among households and individuals and has significantly reduced transaction costs.

imf %>%
  filter(!is.na(i_mob_transactions_value_GDP), year>2011) %>%
  group_by(Region, year) %>%
  summarize(mean = mean(i_mob_transactions_value_GDP, na.rm = TRUE)) %>%
  mutate(Region2 = factor(Region, levels = c("Sub-Saharan Africa", "East Asia & Pacific", "South Asia", "Europe & Central Asia", "Latin America & Caribbean",
                                            "Middle East & North Africa"))) %>%
  mutate(size = ifelse(Region2=="Sub-Saharan Africa", 1, 0)) %>%
  ggplot(aes(x = year, y = mean, color = Region2, size = size)) +
  geom_line() +
  scale_size(range = c(0.6, 1.6), guide="none") +
  labs(
    title = "Mobile money useage has grown significantly in Sub-Saharan Africa",
    subtitle = "Wheras in Latin America and the Middle East, there has been little growth",
    caption = "Source: IMF Financial Access Survey",
    x = "Year",
    y = "Average value of mobile money transactions (% of GDP)"
  ) + 
  scale_x_continuous(breaks = c(2012, 2013, 2014, 2015, 2016, 2017)) +
  scale_color_manual(values = c("#6cbe55", "#800f76", "#51b7d8", "#0b522e", "#fe74fe", "#266197")) +
  geom_point(size = 0.8) +
  my.theme +
  theme(legend.position = c(0.05, 0.97),
        legend.justification = c("left", "top"),
        legend.box.just = "left",
        legend.margin = margin(6, 6, 6, 6),
        legend.box.background = element_rect())

Mobile Money in Africa

Above, we saw that mobile money usage is surging in Sub-Saharan Africa, but which countries account for this growth, and how is the usage distributed by gender?

Below, it is obvious that Kenya leads the way in mobile money, while in some countries, like Ethiopia, mobile money has not taken off. In Ethiopia, low mobile phone subscription is not the main driver of low takeup of mobile money. Rather, the lack of regulation, skills, and the institutions in place to provide digital financial services may be lacking.1 Interestingly, in Lesotho, more women utilize mobile money than males. The proportion of females with an account (bank, other financial institution, or mobile money account) is on par with males: 45% vs. 46%, and thus one can conclude that mobile money has helped close the gender gap in financial access in Lesotho.

findex %>%
  filter(year == 2017, region=="Sub-Saharan Africa (excluding high income)") %>%
  select(country, mobileaccount.t.d.1, mobileaccount.t.d.2) %>%
  filter(!is.na(mobileaccount.t.d.1)) %>%
  arrange(mobileaccount.t.d.2) %>%
  mutate(country = factor(country, country), mobileaccount.t.d.1 = mobileaccount.t.d.1*100, 
         mobileaccount.t.d.2 = mobileaccount.t.d.2*100) %>%
  ggplot() +
  geom_segment(aes(x=country, xend = country, y = mobileaccount.t.d.2,
                   yend = mobileaccount.t.d.1), color = "black") +
  geom_point(aes(x = country, y = mobileaccount.t.d.2), color = "#800f76", size = 2) +
  geom_point(aes(x = country, y = mobileaccount.t.d.1), color = "#6cbe55", size = 2) +
  geom_text(aes(x = "Kenya", y = 65, label = "Female"), nudge_x = -0.7, nudge_y = 0.9,
            color = "black", size = 3, family = "Avenir Next", angle = 20) +
  geom_text(aes(x = "Kenya", y = 78, label = "Male"), nudge_x = -0.7,
            color = "black", size = 3, family = "Avenir Next", angle = 20) +
  coord_flip() +
  labs(
    title = "While Africa leads the way in mobile money access, in almost all countries, a higher proportion 
of males have mobile money accounts",
    subtitle = "Gender Difference in Mobile Money Access, 2017",
    caption = "Note: Excludes South Sudan and Central Africa Republic, for which there is no data.
    Source: Global Findex, 2017",
    y = "% of respondents with mobile money accounts (Age +15)",
    x = NULL
  ) +
  scale_y_continuous(breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80)) +
  my.theme +
  theme(panel.background = element_blank(),
        panel.border = element_blank()) +
  annotate("rect", xmin = 25, xmax = 31, ymin = 61, ymax = 83, alpha = 0.15) +
  annotate("text", x = 28, y = 62, label = "M-Pesa, the leading mobile-money\nservice, was first introduced\nin Kenya in 2007. Since then, mobile\nmoney adoption in Kenya has\nfar exceeded other African countries.", 
           family = "Avenir Next", size = 3, hjust = 0) +
  annotate("text", x = 26, y = 2, label = "In Lesotho, more females utilize\nmobile banking than males.",
           family = "Avenir Next", size = 3, hjust = 0) +
  annotate("rect", xmin = 25, xmax = 27, ymin = 1.5, ymax = 20, alpha = 0.15)

A Closer Look at Kenya

In general, Kenya does well on providing access to finance. However, individuals who have never banked are still an overwhelming majority in the 2015-16 Financial Access Survey.

Below, the map shows the spatial distribution of unbanked individuals at the county-level, standardized as a per capita measure. For reference, the bar chart identifies how counties are categorized by unbanked per capita.

# Make bar plot
finac.k.15 %>%
  mutate(nobank = bank_usage - 2) %>%
  group_by(county) %>%
  filter(nobank==1) %>%
  summarize(n = n()) %>%
  left_join(pop, by = "county") %>%
  mutate(usepcap = (n/pop_2015)*100000) %>%
  ggplot(aes(x = reorder(county, usepcap), y = (usepcap), fill = cut_number(usepcap, 5))) +
  geom_bar(stat = "identity") +
  scale_fill_manual(name = NULL, values = c("#caf7ff", "#91bffc", "#5e8fc9", "#276298", "#003667"),
                    labels = c("Less than 7.72", "7.72-9.74", "9.75-11.4", "11.5-16.9", "17-83.7")) +
  scale_x_discrete(expand = c(0,0)) +
  scale_y_continuous(expand = c(0,0)) +
  labs(
    x = NULL,
    y = NULL,
    title = "Unbanked per capita by county"
  ) +
  my.theme +
  theme(axis.text.x = element_text(angle = 90, hjust = 1),
        axis.line.x.bottom = element_blank(),
        axis.ticks.x = element_blank(),
        legend.position = c(0.05, 0.97),
        legend.justification = c("left", "top"),
        legend.box.just = "left",
        legend.margin = margin(6, 6, 6, 6),
        legend.box.background = element_rect(),
        panel.background = element_blank(),
        panel.border = element_blank())

For context, Isiolo, Marsabit, and Lamu are some of the least populated counties, whereas Nairobi and Nakuru are the most populated.

Individuals who nevered banked are concentrated in three counties: Isiolo, Marsabit, and Lamu

Individuals who never banked per 100,000 in 2015

kenya_map <- finac.k.15 %>%
  mutate(nobank = bank_usage - 2) %>%
  group_by(county) %>%
  filter(nobank==1) %>%
  summarize(n = n()) %>%
  left_join(pop, by = "county") %>%
  mutate(usepcap = (n/pop_2015)*100000) %>%
  left_join(kenya, by = "county") %>%
  cbind(st_coordinates(st_centroid(kenya))) %>%
  st_as_sf()



pal <- colorQuantile(c("#caf7ff", "#91bffc", "#5e8fc9", "#276298", "#003667"),
                     kenya_map$usepcap,
                     n = 5)

labels.county <- sprintf("<strong>%s</strong><br/>%g people per 100,000",
                         kenya_map$county,
                         round(kenya_map$usepcap, digits = 2)) %>% 
  lapply(htmltools::HTML)

  leaflet(kenya_map) %>%
  addPolygons(fillOpacity = 0.7,
              fillColor = ~pal(usepcap),
              weight = 1,
              color = "black",
              highlight = highlightOptions(
                weight = 4,
                color = "white",
                bringToFront = TRUE),
              label = labels.county,
              labelOptions = labelOptions(
                style = list("font-weight" = "normal", padding = "3px 8px"),
                textsize = "15px",
                direction = "auto")
              ) %>%
  addProviderTiles(providers$Esri.WorldGrayCanvas)

Source: 2015-16 Financial Access Survey Population data is a projection from UNICEF

Kenyans utilize all sorts of financial services. A majority of individuals have a savings account, regardless of sex or location. Most individuals living in urban areas use bank accounts, whereas in rural areas, this is less prominent. Instead, individuals in rural areas tend to use more loans. For bank users, the difference in access between urban males and females is significantly different, as is the difference between rural males and females. Finally, few individuals utilize microfinance, which was once touted as a promising international development intervention.2

finac.k.15 %>%
  group_by(cluster_type, gender_of_respondent) %>%
  summarize(Bank = mean(e4_1, na.rm = TRUE)*100,
            SACCO = mean(e4_3, na.rm = TRUE)*100,
            Microfinance = mean(e4_4, na.rm = TRUE)*100,
            Savings = mean(e4_5, na.rm = TRUE)*100,
            Loans = mean(e4_7, na.rm = TRUE)*100,
            Insurance = mean(e4_9, na.rm = TRUE)*100) %>%
  gather("Bank", "SACCO", "Microfinance", "Savings", "Loans", "Insurance", key = "product", value = "proportion") %>%
  unite(area_sex, cluster_type, gender_of_respondent) %>%
  mutate(area_sex = factor(area_sex, levels = c("1_1", "1_2", "2_1", "2_2"),
                           labels = c("Rural male", "Rural female", "Urban male", "Urban female"))) %>%
  mutate(product = factor(product, levels = c("Savings", "Bank", "Loans", "Insurance", "SACCO", "Microfinance"))) %>%
  ggplot(aes(x = product, y = area_sex, fill = proportion)) +
  geom_tile(color = "black", size = 0.25) +
  geom_text(aes(label = paste0(round(proportion,1), "%"), family = "Avenir Next", fontface = "bold")) +
  scale_fill_gradient(name = "Proportion", low = "#bdcfdf", high = "#266197", guide = "colorbar") +
  labs(
    title = "Most Kenyans utilize savings accounts, \nregardless of sex or location",
    subtitle = "The proportion of individuals with particular financial products by sex and area",
    caption = "Note: Individuals can have more than one product, so the rows do not add up to 100.\n\nSACCO: Savings and Credit Cooperatives Societies\nSource: Financial Access Survey 2015-16, Kenya",
    y = NULL,
    x = NULL
  ) +
  my.theme +
  theme(panel.background = element_blank(),
        axis.ticks = element_blank(),
        panel.border = element_blank())

How has financial product usage changed over time? Both savings and bank usage have increased significantly, whereas microfinance has seen little growth.

## Slope graph
finac.k.06 <- mutate(finac.k.06, year = 2006)
finac.k.06 <- rename(finac.k.06, bank_usage = "A4", savings_usage = "X_savings", credit_usage = "X_credit", mfi_usage = "X_cur_mfi", insurance_usage = "X_useins")
finac.k.15 <- mutate(finac.k.15, year = 2015)


y2006 <- finac.k.06 %>%
  select(year, bank_usage, savings_usage, credit_usage, mfi_usage, insurance_usage)
y2015 <- finac.k.15 %>%
  select(year, bank_usage, savings_usage, credit_usage, mfi_usage, insurance_usage)

combine <-bind_rows(y2006, y2015)
combine <- combine %>%
  rename(Banks = "bank_usage", Savings = "savings_usage", Credit = "credit_usage", Microfinance = "mfi_usage", Insurance = "insurance_usage") %>%
  gather(Banks, Savings, Credit, Microfinance, Insurance, key = "type", value = "value") %>%
  group_by(year, type) %>%
  summarize(total1 = sum(value[value==1]), total2 = n(), pct = (total1/total2)*100) %>%
  mutate(type2 = factor(type, levels = c("Savings", "Credit", "Banks", "Insurance", "Microfinance")))

  ggplot(data = combine, aes(x = year, y = pct, group = type2)) +
    geom_line(aes(color = type2), size = 2) +
    geom_point(aes(color = type2), size = 4) +
    scale_x_continuous(name = "Year", position = "top", breaks = c(2006, 2015)) +
    scale_color_manual(values = c("#6cbe55", "#800f76", "#51b7d8", "#0b522e", "#fe74fe", "#266197"), name = "none") +
    geom_label_repel(data = combine %>% filter(year==2006), aes(label = paste0(round(pct, 2), "%")),
              hjust = -0.1,
              vjust = -1,
              family = "Avenir Next",
              size = 4) +
    geom_label_repel(data = combine %>% filter(year==2015), aes(label = paste0(round(pct, 2), "%")),
              hjust = 1,
              vjust = -1,
              family = "Avenir Next",
              size = 4) +
    labs(
      title = "Commercial banks and savings products have seen the \n largest increase in usage from 2006 to 2015",
      subtitle = "Credit and microfinance have hardly changed, \n while insurance has decreased slightly",
      caption = "Note: Individuals may have more than one financial product, \n so these numbers do not sum to 100. \n Source: Financial Access Survey, Kenya, 2006 and 2015"
    ) +
    my.theme +
    theme(
        axis.title.y = element_blank(),
        axis.text.y = element_blank(),
        axis.ticks = element_blank(),
        panel.background = element_blank(),
        panel.border = element_blank())

Access to finance for entrepreneurs is a key ingredient to economic growth. When small-to-medium enterprises, which are characteristic of Kenya, can access financial services, these business can save, invest, and ultimately grow. Yet, surprisingly, few business owners use these services.

# Waffle chart
waffle <- finac.k.15 %>%
  filter(!is.na(l11_1)) %>%
  group_by(l11_1) %>%
  mutate(bank = "Account at a bank") %>%
  summarize(n = n()) %>%
  spread(key = l11_1, value = n) %>%
  rename(`Currently banked` = `1`, `Used to bank` = `2`, `Never banked` = `3`)

  waffle(waffle/10, rows = 10, size = 0.5, colors = c("#6cbe55","#51b7d8", "#fe74fe"), legend_pos = "bottom") +
    my.theme +
    theme(panel.grid = element_blank(), 
          panel.border = element_blank(),
          panel.background = element_blank()) +
    labs(
      title = "An overwhelming majority of Kenyan business-owners \nhave never used a bank account",
      subtitle = "At least for business purposes\n\nEach square represents 10 individuals",
      caption = "Source: Financial Access Survey, 2015-2016, Kenya"
    )

Rather than taking out loans, Kenyan business owners tend to utilize their own personal savings to start their business. This could be a result of a number of issues, including high interest rates or the inability of the financial sector to appropriately access risk. The very small values for males in the top right corner are all 0.6% and less, which includes: Government fund, Don’t known, Mobile, and Money lender. For females, the small value is Government fund, at 0.3%.

# First, create dataframe of labels
label <- finac.k.15 %>%
  filter(l5_1!="NA", l5_1<995) %>%
  mutate(type = factor(l5_1, labels = c("Commercial bank loan", "Microfinance loan",
                                        "SACCO loan", "Money lender", "Chama (Savings group)", 
                                        "Loan from family/friends", "Gift from family/friends", "Income from another business", "Sale of assets", 
                                        "Own savings", "Inherited", "Government fund", "Other", "Don't know", "Mobile" ))) %>%
  group_by(type, gender_of_respondent) %>%
  summarize(n = n()) %>%
  summarize(total1 = sum(n[gender_of_respondent==1]), total2 = sum(n[gender_of_respondent==2])) %>%
  mutate(male = sum(total1), female = sum(total2), pct.m = (total1/male)*100, pct.f = (total2/female)*100) %>%
  gather(pct.f, pct.m, key = "Sex", value = "pct") %>%
  mutate(label = paste0(type, ": ", round(pct, 1), "%")) %>%
  select(type, Sex, label)
  label$Sex[label$Sex=="pct.f"] <- 2
  label$Sex[label$Sex=="pct.m"] <- 1
  label$Sex<- as.numeric(label$Sex)
  
# Now, get dataframe of counts and merge in labels
finac.k.15 %>%
  filter(l5_1!="NA", l5_1<995) %>%
  rename(Sex = "gender_of_respondent") %>%
  mutate(type = factor(l5_1, labels = c("Commercial bank loan", "Microfinance loan",
                                        "SACCO loan", "Money lender", "Chama (Savings group)", 
                                        "Loan from family/friends", "Gift from family/friends", "Income from another business", "Sale of assets", 
                                        "Own savings", "Inherited", "Government fund", "Other", "Don't know", "Mobile" ))) %>%
  group_by(type, Sex) %>%
  summarize(n = n()) %>%
  left_join(label) %>%
  mutate(Sex2 = factor(Sex, levels = c("1", "2"),
                       labels = c("Male", "Female"))) %>%
  ggplot(aes(area = n, fill = Sex2, label = label, subgroup = Sex2)) +
  geom_treemap(fill = "white") +
  geom_treemap(aes(alpha = n)) +
  geom_treemap_subgroup_border(color = "white") +
  geom_treemap_subgroup_text(color = "white", place = "bottomleft", family = "Avenir Next", fontface = "italic") +
  geom_treemap_text(aes(label = label),
                    place = "center",
                    grow = F,
                    color = "black",
                    min.size = 1,
                    reflow = TRUE,
                    family = "Avenir Next"
  ) +
  scale_fill_manual(values = c("#0b522e", "#800f76")) +
  theme(legend.position = "none") +
  labs(title = "Many business owners user their own savings as start-up capital\nrather than loans",
       subtitle = "Females also receive more gifts from family or friends.\n\nIn this survey, females represent about 65% of business owners.",
       caption = "Source: Financial Access Survey, 2015-2016, Kenya"
  ) +
  my.theme

## Data Sources

Bank, The World. n.d.a. “Global Findex.” http://globalfindex.worldbank.org.

———. n.d.b. “World Development Indicators.” http://datacatalog.worldbank.org/dataset/world-development-indicators.

Fund, The International Monetary. n.d. “Financial Access Survey.” http://data.imf.org/?sk=E5DCAB7E-A5CA-4892-A6EA-598B5463A34C.

Kenya, FSD, Central Bank of Kenya, and Kenya National Bureau of Statistics. 2015. “FinAccess Household Survey 2006.” Harvard Dataverse. https://doi.org/10.7910/DVN/39QR9E.

Kenya, Central Bank of, FSD Kenya, and Kenya National Bureau of Statistics. 2016. “FinAccess Household Survey 2015.” Harvard Dataverse. https://doi.org/10.7910/DVN/QUTLO2.